package cn.xuchunh.campusbbs.ui.fragments;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ViewHolder;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.List;

import cn.xuchunh.campusbbs.adapter.SimpleIndicatorAdapter;
import cn.xuchunh.campusbbs.base.BaseRecyclerViewAdapter;
import cn.xuchunh.campusbbs.base.BaseRefreshListFragment;
import cn.xuchunh.campusbbs.widget.DividerItemDecoration;

/**
 * Created by XuChunH on 2015/10/18.
 */
public abstract class SimpleIndicatorListFragment<VH extends ViewHolder, T> extends BaseRefreshListFragment<VH, T> {
    @Override
    protected RecyclerView.LayoutManager createLayoutManager() {
        return new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
    }

    @SuppressWarnings("unchecked")
    @Override
    protected BaseRecyclerViewAdapter createAdapter() {
        return new SimpleIndicatorAdapter(getActivity());
    }

    @Override
    protected List<T> parse(JSONObject jsonObject) throws JSONException {
        return null;
    }

    @Override
    protected void loadDataFromServer() {

    }

    @Override
    public String getVolleyTag() {
        return null;
    }

    @Override
    protected void afterInitView() {
        getRefreshLayout().setEnabled(false);
        getRecyclerView().addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));
        loadData(false);
    }
}
